<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Title</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <div id="app">
        <div>
            <h2>我是标题</h2>
            <p>我是内容</p>
        </div>

        <cpn1></cpn1>
        <cpn2></cpn2>
    </div>

    <script>
        //1、创建组件构造器

        //2、注册全局组件
        Vue.component('cpn1', ({
            template: `   <div>
            <h2>我是标题</h2>
            <p>我是内容</p>
        </div>`
        }))



        const vm = new Vue({
            el: '#app',
            data: {
                message: '我是你爹!'
            },
            methods: {},
            components: {
                // 注册局部组件
                cpn2: {
                    template: `   <div>
            <h2>我是标题222</h2>
            <p>我是内容2222</p>
        </div>`
                }
            }
        });
    </script>
</body>

</html>